<script setup>
import * as echarts from 'echarts'
import { onMounted } from 'vue'
import { ref } from 'vue'

const charts = ref()

onMounted(() => {
  let myCharts = echarts.init(charts.value)

  myCharts.setOption({
    title: {
      text: '散点图',
      textStyle: {
        color: '#29fcff',
        fontSize: 16
      }
    },
    grid: {
      left: 20,
      top: 40,
      right: 20,
      bottom: 20
    },
    xAxis: {
      type: 'category'
    },
    yAxis: {
      show: false
    },
    series: [
      {
        type: 'scatter',
        data: [342,414,524,134,535,746,134,646,1435,341,424],
        label: {
          show: true,
          position: 'top',
          textStyle: {
            color: 'white'
          }
        },
        symbol: 'arrow',
        symbolOffset: [0, -20],
        itemStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [{
              offset: 0, color: 'red' // 0% 处的颜色
            }, {
              offset: 1, color: 'blue' // 100% 处的颜色
            }],
            global: false // 缺省为 false
          }
        }
      }
    ]
  })
})
</script>

<template>
  <div class="box7">
    <div class="title">
      <p>年度游客量对比</p>
      <img src="../../images/dataScreen-title.png" alt="">
    </div>
    <div class="charts" ref="charts">

    </div>
  </div>
</template>

<style scoped lang="less">
.box7 {
  background: url(../../images/dataScreen-main-rc.png) no-repeat;
  background-size: 100% 100%;
  .title {
    p {
      font-size: 16px;
      margin-bottom: 8px;
    }
  }
  .charts {
    height: 250px;
  }
}
</style>
